package com.wjy.demo.controller;


import com.wjy.demo.entity.UserInfo;
import com.wjy.demo.service.UserService;
import com.wjy.demo.vo.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/wxuser")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/insert")
    public Response register(@RequestBody UserInfo userInfo) {
        return Response.success(userService.insert(userInfo));

    }
    @PostMapping("/update")
    public Response update(@RequestBody UserInfo userInfo) {

        return Response.success(userService.update(userInfo));
    }

    @GetMapping("/queryById")
    public Response view(Long id) {

        return Response.success(userService.queryById(id));
    }

    @GetMapping("/queryByOpenId")
    public Response viewByOpenId(String openId) {

        return Response.success(userService.queryByOpenId(openId));
    }

}
